const util = require('../../utils/util.js');
const user = require('../../services/user.js');
const Toast = require('../../utils/toast.js');
Page({
  data: {
    schoollist: [],
    myfollowschool: [],
    followschoollist: [],
    isFromSearch: true, // 用于判断schoollist数组是不是空数组，默认true，空的数组
    currentTab: 1, // 设置加载的第几次，默认是第一次
    isHideLoadMore: true, //"上拉加载"的变量，默认true，隐藏
    isHideLoadComplete: false //“没有数据”的变量，默认false，隐藏
  },
  onLoad: function () {
    this.getschoollist();
    //this.schoollist()
  },
  getschoollist: function () {
    let that = this;
    util.request('school/getteacherlist').then(function (res) {
      console.log(res.data);
      if (res.errno === 0) {
        that.setData({
          schoollist: res.data,
        });
      }
    });
  },
  toteacherdetails(e) {
    let id = e.currentTarget.dataset.id;
    let schoolid = e.currentTarget.dataset.schoolid;
    if (id & schoolid) {
      wx.navigateTo({
        url: `/pages/teacherdetails/teacherdetails?id=${id}&schoolid=${schoolid}`
      })
    }
  },
})